package com.thread.www;

import com.thread.www.demo.Count;

/**
 * Created by 27340 on 2017/3/14.
 */
public class ThreadMain {
    public static void main(String[] args){
        testSyc();
    }

    public static void testSyc(){
        Count count = new Count();
        test2();
    }

    public static void test1(){
        final Count count = new Count();
        ThreadB threadb = new ThreadB();
        for(int i=0;i<5;i++){
            ThreadScy threadScy = new ThreadScy(count);
            threadScy.start();
        }
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("num : " + count.getNum());
    }

    public static void test2(){
        final ThreadLockTest count = new ThreadLockTest();
        for(int i =0;i<2;i++){
            new Thread(){
                public void run(){
                    count.put();
                }
            }.start();
        }
        System.out.println("1111");
        for(int i =0;i<2;i++){
            new Thread(){
                public void run(){
                    count.get();
                }
            }.start();
        }
    }
}
